<!doctype html>
<html lang="en">
<head>
    <title>Code coverage report for src/assets/octopus/engine/tools.js</title>
    <meta charset="utf-8" />
    <link rel="stylesheet" href="..\..\..\..\prettify.css" />
    <link rel="stylesheet" href="..\..\..\..\base.css" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <style type='text/css'>
        .coverage-summary .sorter {
            background-image: url(..\..\..\..\sort-arrow-sprite.png);
        }
    </style>
</head>
<body>
<div class='wrapper'>
  <div class='pad1'>
    <h1>
      <a href="..\..\..\..\index.html">All files</a> / <a href="index.html">src/assets/octopus/engine</a> tools.js
    </h1>
    <div class='clearfix'>
      <div class='fl pad1y space-right2'>
        <span class="strong">0% </span>
        <span class="quiet">Statements</span>
        <span class='fraction'>0/106</span>
      </div>
      <div class='fl pad1y space-right2'>
        <span class="strong">0% </span>
        <span class="quiet">Branches</span>
        <span class='fraction'>0/50</span>
      </div>
      <div class='fl pad1y space-right2'>
        <span class="strong">0% </span>
        <span class="quiet">Functions</span>
        <span class='fraction'>0/21</span>
      </div>
      <div class='fl pad1y space-right2'>
        <span class="strong">0% </span>
        <span class="quiet">Lines</span>
        <span class='fraction'>0/106</span>
      </div>
    </div>
  </div>
  <div class='status-line low'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">function <span class="fstat-no" title="function not covered" >oToolsEngine(engine) {</span>
<span class="cstat-no" title="statement not covered" >  this.engine = engine;</span>
<span class="cstat-no" title="statement not covered" >  this.base64 = Dan.Base64;</span>
}
&nbsp;
oToolsEngine.prototype = {
  // 获取前端八爪鱼框架配置，此处因为是初始化所以不能使用tips、template引擎。
  md5: <span class="fstat-no" title="function not covered" >function (</span>val) {
<span class="cstat-no" title="statement not covered" >    return Md5(val).toString().toLocaleUpperCase();</span>
  },
  guid: <span class="fstat-no" title="function not covered" >function () </span>{
    let key = <span class="cstat-no" title="statement not covered" >this.md5(new Date().getTime() + "M&amp;J" + new Date().getTime());</span>
<span class="cstat-no" title="statement not covered" >    if (key.length == 32) {</span>
<span class="cstat-no" title="statement not covered" >      key = key.substring(0, 6) + "-" + key.substring(6, 11) + "-" + key.substring(11, 16)</span>
        + "-" + key.substring(16, 21) + "-" + key.substring(21, 26) + "-" + key.substring(26, 32);
    }
<span class="cstat-no" title="statement not covered" >    return key.toLocaleUpperCase();</span>
  },
  IsNullOrEmpty: <span class="fstat-no" title="function not covered" >function (</span>val) {
<span class="cstat-no" title="statement not covered" >    if (val != null &amp;&amp; val.toString() != "") {</span>
<span class="cstat-no" title="statement not covered" >      return false;</span>
    }
<span class="cstat-no" title="statement not covered" >    return true;</span>
  },
  isMobile: <span class="fstat-no" title="function not covered" >function () </span>{
    var userAgentInfo = <span class="cstat-no" title="statement not covered" >navigator.userAgent;</span>
    var mobileAgents = <span class="cstat-no" title="statement not covered" >["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];</span>
    var mobile_flag = <span class="cstat-no" title="statement not covered" >false;</span>
    //根据userAgent判断是否是手机
<span class="cstat-no" title="statement not covered" >    for (var v = 0; v &lt; mobileAgents.length; v++) {</span>
<span class="cstat-no" title="statement not covered" >      if (userAgentInfo.indexOf(mobileAgents[v]) &gt; 0) {</span>
<span class="cstat-no" title="statement not covered" >        mobile_flag = true;</span>
<span class="cstat-no" title="statement not covered" >        break;</span>
      }
    }
    var screen_width = <span class="cstat-no" title="statement not covered" >window.screen.width;</span>
    var screen_height = <span class="cstat-no" title="statement not covered" >window.screen.height;</span>
    //根据屏幕分辨率判断是否是手机
<span class="cstat-no" title="statement not covered" >    if (screen_width &lt; 500 &amp;&amp; screen_height &lt; 800) {</span>
<span class="cstat-no" title="statement not covered" >      mobile_flag = true;</span>
    }
<span class="cstat-no" title="statement not covered" >    return mobile_flag;</span>
  },
  // 转换八爪鱼特色代码，正则提取，主要支持#{param=xxxx}，
  parseScript: <span class="fstat-no" title="function not covered" >function (</span>data) {
<span class="cstat-no" title="statement not covered" >    if (!this.IsNullOrEmpty(data)) {</span>
      // console.log("source.data.value: " + data + ", router.query:" + JSON.stringify(this.engine.router.get().query));
      let o = <span class="cstat-no" title="statement not covered" >this;</span>
      // 字符串化，java不能自转，且复选控件返回是数组格式，此处必须转换为字符串，否则保存都有问题。
      let parseData = <span class="cstat-no" title="statement not covered" >data.toString();</span>
      let regex = <span class="cstat-no" title="statement not covered" >/\#{(.+?)\}/g; // {} 花括号，大括号</span>
      // 返回的是数组，采用Jq循环
<span class="cstat-no" title="statement not covered" >      $(parseData.match(regex)).each(<span class="fstat-no" title="function not covered" >function (</span>index, item) {</span>
        // 得到类型
        let type = <span class="cstat-no" title="statement not covered" >item.split("{")[1].split("=")[0];</span>
        let value = <span class="cstat-no" title="statement not covered" >item.split("=")[1].split("}")[0];</span>
        // 解析URL参数
        // console.log(type + "," + value);
<span class="cstat-no" title="statement not covered" >        if (type == "param") {</span>
<span class="cstat-no" title="statement not covered" >          value = o.engine.router.get().query[value];</span>
          // 如果未匹配到，则返回空，匹配失败。
<span class="cstat-no" title="statement not covered" >          value = value == undefined ? "" : value;</span>
<span class="cstat-no" title="statement not covered" >          parseData = parseData.replace(item, value);</span>
        }
        // xxxxx。
        else <span class="cstat-no" title="statement not covered" >if (type == "xxxx") {</span>
&nbsp;
        }
      });
      // console.log(parseData.match(regex));
<span class="cstat-no" title="statement not covered" >      return parseData;</span>
    }
<span class="cstat-no" title="statement not covered" >    return data;</span>
&nbsp;
    // JavaScript正则表达式在线测试工具：
    // http://tools.jb51.net/regex/javascript
    // 正则表达式在线生成工具：
    // http://tools.jb51.net/regex/create_reg
    // var str="123{xxxx}456[我的]789123[你的]456(1389090)789";
    // var regex1 = /\((.+?)\)/g;  // () 小括号
    // var regex2 = /\[(.+?)\]/g;  // [] 中括号
    // var regex3 = /\{(.+?)\}/g; // {} 花括号，大括号
    // console.log(str.match(regex1));
    // console.log(str.match(regex2));
    // console.log(str.match(regex3));
  },
  // 适配于八抓鱼数据源的Cell数据
  parseCell: <span class="fstat-no" title="function not covered" >function (</span>data, name) {
    // 对象不能为空
<span class="cstat-no" title="statement not covered" >    if(!this.IsNullOrEmpty(data.cellData)) {</span>
      let findList = <span class="cstat-no" title="statement not covered" >$.grep(data.cellData, <span class="fstat-no" title="function not covered" >function (</span>item) {</span>
<span class="cstat-no" title="statement not covered" >        return item.name == name;//筛选出当前数据列数据</span>
      });
      // alert(JSON.stringify(linkColumn));
<span class="cstat-no" title="statement not covered" >      if (findList.length == 1) {</span>
        // 赋值
<span class="cstat-no" title="statement not covered" >        return findList[0];</span>
      }
    }
<span class="cstat-no" title="statement not covered" >    return null;</span>
  },
  date: <span class="fstat-no" title="function not covered" >function (</span>fmt) {
<span class="cstat-no" title="statement not covered" >    return this.dateFormat(new Date(), fmt);</span>
  },
  dateFormatToString: <span class="fstat-no" title="function not covered" >function (</span>date, fmt) {
<span class="cstat-no" title="statement not covered" >    return this.dateFormat(new Date(date), fmt);</span>
  },
  // 获取日期
  dateFormat: <span class="fstat-no" title="function not covered" >function (</span>date, fmt) {
    // 对Date的扩展，将 Date 转化为指定格式的String
    // 月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符，
    // 年(y)可以用 1-4 个占位符，毫秒(S)只能用 1 个占位符(是 1-3 位的数字)
    // 例子：
    // (new Date()).Format("yyyy-MM-dd hh:mm:ss.S") ==&gt; 2006-07-02 08:09:04.423
    // (new Date()).Format("yyyy-M-d h:m:s.S")      ==&gt; 2006-7-2 8:9:4.18
    // let date = new Date();
    let o = <span class="cstat-no" title="statement not covered" >{</span>
      "M+": date.getMonth() + 1,                   //月份
      "d+": date.getDate(),                        //日
      "H+": date.getHours(),                       //小时
      "m+": date.getMinutes(),                     //分
      "s+": date.getSeconds(),                     //秒
      "q+": Math.floor((date.getMonth() + 3) / 3), //季度
      "S": date.getMilliseconds()                  //毫秒
    };
<span class="cstat-no" title="statement not covered" >    if (/(y+)/.test(fmt))</span>
<span class="cstat-no" title="statement not covered" >      fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));</span>
<span class="cstat-no" title="statement not covered" >    for (var k in o)</span>
<span class="cstat-no" title="statement not covered" >      if (new RegExp("(" + k + ")").test(fmt))</span>
<span class="cstat-no" title="statement not covered" >        fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));</span>
<span class="cstat-no" title="statement not covered" >    return fmt;</span>
  },
  // 白忙活一场。。。毫无意义。。。fuck
  // 更新对象，精确到底层变量，如果是数组或对象直接[]、= 赋值的话 vue 不认。。。，object是将被更新的数据，update是更新数据，如果update中的数据object没有，则直接push，有则递归更新。
  updateObject: <span class="fstat-no" title="function not covered" >function (</span>object, update) {
<span class="cstat-no" title="statement not covered" >    this.engine.tips.debug("[Update Object] Original:" + JSON.stringify(object));</span>
<span class="cstat-no" title="statement not covered" >    this.engine.tips.debug("[Update Object] Update:" + JSON.stringify(update));</span>
    // 循环当前集合
<span class="cstat-no" title="statement not covered" >    for (let param in update) {</span>
      // https://blog.csdn.net/zjy_android_blog/article/details/81023177
      // 判断类型，狸猫换太子
      let checkPrototype = <span class="cstat-no" title="statement not covered" >Object.prototype.toString;</span>
      // 判断js 7种数据类型 【字符串、数字、布尔、数组、对象、Null、Undefined】
      let type = <span class="cstat-no" title="statement not covered" >checkPrototype.call(update[param]);</span>
      // 如果是数组或者集合，则进行完整替换或直接传入。
<span class="cstat-no" title="statement not covered" >      if (type.indexOf("Array") != -1 || type.indexOf("Object") != -1) {</span>
        // 如果原始对象不存在，则直接完整覆盖。
<span class="cstat-no" title="statement not covered" >        if (checkPrototype.call(object[param]).indexOf("Undefined") != -1) {</span>
<span class="cstat-no" title="statement not covered" >          this.engine.vue.$set(object, param, update[param]);</span>
        }
        // 如果存在数组，则进去一个个替换，总之vue更新只能到最底层变量更新才行。fuck。。。
        else {
<span class="cstat-no" title="statement not covered" >          this.updateObject(object[param], update[param]);</span>
        }
      }
      // else if (type.indexOf("Null") != -1) {
      //
      // }
      // else if (type.indexOf("Undefined") != -1) {
      //
      // }
      // 剩余6种可以直接比较。
      else {
        // 通过原型判断 Undefined 因为 (undefined == null) = true 故 找不到undefined说明当前属性存在于原始对象中，则执行更新操作。
<span class="cstat-no" title="statement not covered" >        if (checkPrototype.call(object[param]).indexOf("Undefined") == -1) {</span>
          // 哪怕存在，如果没有改变也不发起更新操作。
<span class="cstat-no" title="statement not covered" >          if (object[param] != update[param]) {</span>
<span class="cstat-no" title="statement not covered" >            object[param] = update[param];</span>
            // object[param].splice(update[param].length);
            // this.engine.vue.$set(object, param, update[param]);
<span class="cstat-no" title="statement not covered" >            this.engine.tips.debug("[Update Object] Object Update: " + param + ":" + type);</span>
          }
        } else {
          // 变量新增数据，必须采用vue的$set方法，更新可以直接响应。
<span class="cstat-no" title="statement not covered" >          this.engine.vue.$set(object, param, update[param]);</span>
<span class="cstat-no" title="statement not covered" >          this.engine.tips.debug("[Update Object] Object Insert: " + param + ":" + type);</span>
        }
      }
      // this.engine.tips.debug("[Update Object] Object Parse: " + param + "，update type:" + type
      //   + ", original type" + checkPrototype.call(object[param]));
    }
&nbsp;
<span class="cstat-no" title="statement not covered" >    this.engine.tips.debug("[Update Object] Updated:" + JSON.stringify(object) + ",");</span>
  },
  findCell: <span class="fstat-no" title="function not covered" >function (</span>data, name) {
    let find = <span class="cstat-no" title="statement not covered" >$.grep(data, <span class="fstat-no" title="function not covered" >function (</span>value) {</span>
<span class="cstat-no" title="statement not covered" >      return value.name == "name";//筛选出类型ID数据，便于监听；</span>
    });
<span class="cstat-no" title="statement not covered" >    if (find.length == 1) {</span>
<span class="cstat-no" title="statement not covered" >      return find[0];</span>
    } else {
<span class="cstat-no" title="statement not covered" >      return null;</span>
    }
  },
  // 和api保持一致
  translate: <span class="fstat-no" title="function not covered" >function (</span>text, from, to, callback) {
    let appid = <span class="cstat-no" title="statement not covered" >'20160719000025476';</span>
    let key = <span class="cstat-no" title="statement not covered" >'nh2h5OgnbJg2ccId1HhG';</span>
    let salt = (<span class="cstat-no" title="statement not covered" >new Date).getTime();</span>
    // 多个query可以用\n连接  如 query='apple\norange\nbanana\npear'
    let f = <span class="cstat-no" title="statement not covered" >from;</span>
    let t = <span class="cstat-no" title="statement not covered" >to;</span>
    let str1 = <span class="cstat-no" title="statement not covered" >appid + text + salt + key;</span>
    let sign = <span class="cstat-no" title="statement not covered" >this.md5(str1).toLocaleLowerCase();// 百度只接受小写的md5。</span>
&nbsp;
    // 下面要替换成八爪鱼自己的框架引擎
<span class="cstat-no" title="statement not covered" >    this.engine.request.getJSONP("http://api.fanyi.baidu.com/api/trans/vip/translate", {</span>
      q: text, appid: appid, salt: salt, from: f, to: t, sign: sign
    }, <span class="fstat-no" title="function not covered" >function (</span>data) {
      // 如果有返回结果
<span class="cstat-no" title="statement not covered" >      if (data.trans_result) {</span>
<span class="cstat-no" title="statement not covered" >        if (callback) {</span>
          // 因为百度翻译API免费版设置了请求频次间隔。。。所以延迟1秒回调，相当于阻塞了。
<span class="cstat-no" title="statement not covered" >          setTimeout(<span class="fstat-no" title="function not covered" >function () </span>{</span>
<span class="cstat-no" title="statement not covered" >            callback(data.trans_result[0].dst)</span>
          }, 1000);
        }
      }
    });
  },
  // 启动NFC扫描
  NFCStart:<span class="fstat-no" title="function not covered" >function()</span>{
<span class="cstat-no" title="statement not covered" >    if (window.NFCStart) {</span>
<span class="cstat-no" title="statement not covered" >      window.NFCStart();</span>
    }
    else <span class="cstat-no" title="statement not covered" >if(window.Android){</span>
      // 需要弹出遮罩，因为Android没有扫描。
&nbsp;
&nbsp;
<span class="cstat-no" title="statement not covered" >      window.Android.NFCStart();</span>
    }
  },
  // 工具md5示例
  tool_md5: <span class="fstat-no" title="function not covered" >function () </span>{
<span class="cstat-no" title="statement not covered" >    md5(''); // d41d8cd98f00b204e9800998ecf8427e</span>
<span class="cstat-no" title="statement not covered" >    md5('The quick brown fox jumps over the lazy dog'); // 9e107d9d372bb6826bd81d3542a419d6</span>
<span class="cstat-no" title="statement not covered" >    md5('The quick brown fox jumps over the lazy dog.'); // e4d909c290d0fb1ca068ffaddf22cbd0</span>
&nbsp;
    // It also supports UTF-8 encoding
<span class="cstat-no" title="statement not covered" >    md5('中文'); // a7bac2239fcdcb3a067903d8077c4a07</span>
&nbsp;
    // It also supports byte `Array`, `Uint8Array`, `ArrayBuffer`
<span class="cstat-no" title="statement not covered" >    md5([]); // d41d8cd98f00b204e9800998ecf8427e</span>
<span class="cstat-no" title="statement not covered" >    md5(new Uint8Array([])); // d41d8cd98f00b204e9800998ecf8427e</span>
&nbsp;
    // Different output
<span class="cstat-no" title="statement not covered" >    md5(''); // d41d8cd98f00b204e9800998ecf8427e</span>
<span class="cstat-no" title="statement not covered" >    md5.hex(''); // d41d8cd98f00b204e9800998ecf8427e</span>
<span class="cstat-no" title="statement not covered" >    md5.array(''); // [212, 29, 140, 217, 143, 0, 178, 4, 233, 128, 9, 152, 236, 248, 66, 126]</span>
<span class="cstat-no" title="statement not covered" >    md5.digest(''); // [212, 29, 140, 217, 143, 0, 178, 4, 233, 128, 9, 152, 236, 248, 66, 126]</span>
<span class="cstat-no" title="statement not covered" >    md5.arrayBuffer(''); // ArrayBuffer</span>
<span class="cstat-no" title="statement not covered" >    md5.buffer(''); // ArrayBuffer, deprecated, This maybe confuse with Buffer in node.js. Please use arrayBuffer instead.</span>
  },
  tool_base64: <span class="fstat-no" title="function not covered" >function () </span>{
<span class="cstat-no" title="statement not covered" >    Dan.Base64.encode('dankogai');  // ZGFua29nYWk=</span>
<span class="cstat-no" title="statement not covered" >    Dan.Base64.encode('小飼弾');    // 5bCP6aO85by+</span>
<span class="cstat-no" title="statement not covered" >    Dan.Base64.encodeURI('小飼弾'); // 5bCP6aO85by-</span>
&nbsp;
<span class="cstat-no" title="statement not covered" >    Dan.Base64.decode('ZGFua29nYWk=');  // dankogai</span>
<span class="cstat-no" title="statement not covered" >    Dan.Base64.decode('5bCP6aO85by+');  // 小飼弾</span>
    // note .decodeURI() is unnecessary since it accepts both flavors
<span class="cstat-no" title="statement not covered" >    Dan.Base64.decode('5bCP6aO85by-');  // 小飼弾</span>
  }
}
&nbsp;
export {
  oToolsEngine
}
&nbsp;
&nbsp;
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
  Code coverage
  generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Mon Jan 20 2020 17:54:15 GMT+0800 (GMT+08:00)
</div>
</div>
<script src="..\..\..\..\prettify.js"></script>
<script>
window.onload = function () {
        if (typeof prettyPrint === 'function') {
            prettyPrint();
        }
};
</script>
<script src="..\..\..\..\sorter.js"></script>
</body>
</html>
